<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Upload extends CI_Upload {

    function MY_Upload($props = array())
    {
        parent::CI_Upload($props);
    }

    function _prep_filename($filename)
    {
        $filenameReload = parent::_prep_filename($filename);

        $ext = $this->get_extension($filenameReload);

        $filenameOnly = str_replace($ext,'',$filenameReload);

        if(preg_match("/[\x{4e00}-\x{9fa5}]+/u",$filenameOnly))
        {
            $CI = &get_instance();
            $CI->load->helper('pinyin');
            $CI->benchmark->mark('str2py');
            $filenameOnly = GetPinyin($filenameOnly);
            $CI->benchmark->mark('str2py_end');
        }

        return $filenameOnly.$ext;
    }

}

/* End of file MY_Upload.php */
/* Location ./application/libraries/MY_Upload.php */
